using System;
using System.Collections.Generic;
using System.Text;

namespace miciv.Rendering
{
    public class ManagedResourceManager
    {
        protected List<IManagedResource> m_lstResurces;

        public ManagedResourceManager()
        {
            this.m_lstResurces = new List<IManagedResource>();
        }

        public void Add(IManagedResource _resource)
        {
            if (false == this.m_lstResurces.Contains(_resource))
            {
                this.m_lstResurces.Add(_resource);
            }
        }

        public void Remove(IManagedResource _resource)
        {
            if (false != this.m_lstResurces.Contains(_resource))
            {
                this.m_lstResurces.Remove(_resource);
            }
        }

        public void DeviceLost()
        {
            foreach (IManagedResource resource in this.m_lstResurces)
            {
                resource.DeviceLost();
            }
        }

        public void DeviceReset()
        {
            foreach (IManagedResource resource in this.m_lstResurces)
            {
                resource.DeviceReset();
            }
        }
    }
}
